package com.hgw.AiToImage.config;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class ConfigLoader {
    private static final Properties PROPERTIES = new Properties();

    static {
        try (InputStream input = ConfigLoader.class.getClassLoader()
                .getResourceAsStream("liblibai.properties")) {
            if (input == null) {
                throw new RuntimeException("无法加载配置文件 'liblibai.properties'");
            }
            PROPERTIES.load(input);
        } catch (IOException ex) {
            throw new RuntimeException("加载配置文件时出错", ex);
        }
    }

    public static String getProperty(String key) {
        return PROPERTIES.getProperty(key);
    }

    public static String getAccessKey() {
        return getProperty("accessKey");
    }

    public static String getSecretKey() {
        return getProperty("secretKey");
    }
}
